#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define R register
using namespace std;
const int MAXN=8010;
int n,q;
int fid[MAXN];
struct node{
	int val,id;
}a[MAXN];
inline bool cmp(node x,node y){
	if(x.val==y.val)return x.id<y.id;
	return x.val<y.val;
}
inline void ssort(int x,bool f){
	if(f){
		for(R int i=x;i<n;i++){
			if(a[i].val>a[i+1].val||(a[i].val==a[i+1].val&&a[i].id>a[i+1].id)){
				node t=a[i];
				a[i]=a[i+1];
				a[i+1]=t;
			}
			else break;
		}
	}
	else{
		for(R int i=x;i>1;i--){
			if(a[i].val<a[i-1].val||(a[i].val==a[i-1].val&&a[i].id<a[i-1].id)){
				node t=a[i];
				a[i]=a[i-1];
				a[i-1]=t;
			}
			else break;
		}
	}
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(R int i=1;i<=n;i++){
		scanf("%d",&a[i].val);
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	for(R int i=1;i<=n;i++)fid[a[i].id]=i;
	while(q--){
		int op;
		scanf("%d",&op);
		if(op==1){
			R int x,y;
			scanf("%d%d",&x,&y);
			R bool f=a[fid[x]].val<y;
			a[fid[x]].val=y;
			ssort(fid[x],f);
			for(R int i=1;i<=n;i++)fid[a[i].id]=i;
		}
		if(op==2){
			R int x;
			scanf("%d",&x);
			printf("%d\n",fid[x]);
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
